package com.ytrsoft.controller;

import com.ytrsoft.entity.User;
import com.ytrsoft.response.ResponseEntity;
import com.ytrsoft.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
@Tag(name = "用户接口")
public class UserRestController extends BaseRestController<User> {

    private final UserService userService;

    public UserRestController(UserService userService) {
        super(userService);
        this.userService = userService;
    }

    @GetMapping("/findByDeviceId/{deviceId}")
    @Operation(summary = "根据设备ID查询")
    public ResponseEntity<User> findByDeviceId(@PathVariable String deviceId) {
        User user = userService.findByDeviceId(deviceId);
        return ResponseEntity.succeed(user);
    }
}